<?php

/*
 * liuyan表
 */
class LiuyanModel extends Model{
    protected $_validate = array(
        array('name','require','联系人不能为空'),
        array('phone','/^13[0-9]{1}[0-9]{8}$|15[0189]{1}[0-9]{8}$|189[0-9]{8}$/','请填写正确的手机号码'),
        array('dizhi','require','联系地址不能为空'),
        array('content','require','内容不能为空'),
        array('email','email','请填写正确的邮箱'),
        array('sid','get_sid','你已经提交过了，请两个小时后再提交',1,'callback')
    );
    
    protected $_auto = array(
        array('pubdate','time',1,'function'),
        array('sid','session_id',1,'function'),
    );
    
    protected function get_sid(){
        $list = $this->where(array('sid'=>  session_id()))->order('id desc')->find();

        if($list){
            if($list['pubdate'] > ($list['pubdate']-7200)){
                return false;
            }
        }
    }
}